# HIVERnote v0.2
# Changelog
# - title added

import connect
import ConfigParser
import sys
import os
os.system('title HIVERnote')

# VARS
consumerKey = 
consumerSecret = 
userStoreUri = "https://www.evernote.com/edam/user"
noteStoreUriBase = "http://www.evernote.com/edam/note/"
# userStoreUri = "https://sandbox.evernote.com/edam/user"
# noteStoreUriBase = "http://sandbox.evernote.com/edam/note/"

print "Enter your note :"

# USER INPUT
userinput = raw_input(">> ")
userinput = userinput.decode(sys.stdin.encoding)
userinput = userinput.encode("utf-8")

# CONFIG VARS
config = ConfigParser.ConfigParser()
config.read("settings.ini")

username = config.get("main", "username")
password = config.get("main", "password")
note = config.get("main", "note")
pref = config.get("main", "prefix")

# CONNECTION
connector = connect.EvernoteConnector(username, password,
        consumerKey, consumerSecret, userStoreUri,
        noteStoreUriBase)

# UPDATE
notelist = connector.getNoteList()
notes = connector.getNotes([note])
connector.updateNote(notes[0]["guid"], scontent=notes[0]["content"],
        content=userinput, title=notes[0]["title"], append=True, prefix=pref)

print "Note saved"
